import { _decorator, Component, easing, Node, Tween, tween, v3, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('RoundTextTip')
export class RoundTextTip extends Component {
    private _startNode: Node;
    private _endNode: Node;

    start() {
        this._startNode = this.node.getChildByName('start');
        this._endNode = this.node.getChildByName('end');
        this._startNode.active = false;
        this._endNode.active = false;
    }
    clear() {
        this._startNode.active = false;
        this._endNode.active = false;
    }
    showStart(avtve: boolean) {
        this._startNode.active = avtve;
        this._endNode.active = false;
        this._endNode.scale = Vec3.ZERO;
    }
    showEnd() {
        this._startNode.active = false;
        this._endNode.active = true;
        this._endNode.scale = Vec3.ZERO;
        new Tween<{ scale: Vec3 }>({ scale: this._endNode.scale })
            .to(0.25, { scale: v3(1.1, 1.1, 1.1) }, {
                onUpdate: (target: { scale: Vec3 }, ratio) => {
                    this._endNode.scale = target.scale;
                },
            })
            .to(0.2, { scale: Vec3.ONE }, {
                onUpdate: (target: { scale: Vec3 }, ratio) => {
                    this._endNode.scale = target.scale;
                },
            }).start();




    }
    update(deltaTime: number) {

    }
}


